package com.gaofen.exceltoword.controller;


import com.alibaba.fastjson.JSON;
import com.gaofen.exceltoword.entity.exceltoword.*;
import com.gaofen.exceltoword.entity.xueyuandata.*;
import com.gaofen.exceltoword.service.*;
import com.gaofen.exceltoword.util.ExcelReaderWhshape;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@Slf4j
@RestController
@RequestMapping("/exceltoword")
@CrossOrigin(origins = "*")
public class WhshapeController {

    @Resource
    public PathRecordService pathRecordService;

    @Resource
    public WhshapeService whshapeService;

    @Resource
    public LdshapeService ldshapeService;

    @Resource
    KsscshapeService ksscshapeService;

    @Resource
    KstcshapeService kstcshapeService;

    @Resource
    KsyzlshapeService ksyzlshapeService;

    @Resource
    public WhshapeAdditionService whshapeAdditionService;

    @Resource
    public WhshapeReductionService whshapeReductionService;

    @Resource
    public ZrbhdshapeService zrbhdshapeService;

    @Resource
    public WgjyshapeService wgjyshapeService;

    @Resource
    public ExcelReaderWhshape excelReaderWhshape;


    /**
     * 耕地*/
    @RequestMapping(value = "/insertexcel")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<String> insertExcel(String path){

        try {
            if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }
                List<Whshape> whshapeList = excelReaderWhshape.readExcelDataGD(path);
                PathName pathName = pathRecordService.selectPath(path);
                if (pathName != null){
                    if(pathName.pathname != ""){
                        return new ResponseEntity<String>("error:the file has been uploaded",HttpStatus.OK);
                    }
                }
            boolean success = whshapeService.insertWhshape(whshapeList) > 0;
            pathRecordService.insertPathName(path);
            return new ResponseEntity<String>("success",HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }

    }

    @PostMapping( value = "/insertexcelfile" )
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<JSON> insertExcelFile(@RequestParam("file") MultipartFile multipartFile){

        try {
            /*if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }*/
            File file = null;
                String originalFilename = multipartFile.getOriginalFilename();
                String[] filename = originalFilename.split("\\.");
                file=File.createTempFile(filename[0], filename[1] + ".");
                multipartFile.transferTo(file);

            List<Whshape> whshapeList = excelReaderWhshape.readExcelDataGDWJ(file);
            PathName pathName = pathRecordService.selectPath(originalFilename);
            if (pathName != null){
                if(pathName.pathname != ""){
                    return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"error:文件已上传file has been uploaded\"}"),HttpStatus.OK);
                }
            }
            boolean success = whshapeService.insertWhshape(whshapeList) > 0;
            pathRecordService.insertPathName(originalFilename);
            file.deleteOnExit();
            return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"成功success\"}"),HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("[SQL operation failed]", e);
        }
    }

    @RequestMapping(value = "/selectWhshape")
    //@GetMapping(value = "/{path}")
    public List<Whshape> selectWhshapeDataList(String jcsj){
        List<Whshape> whshapeList = new ArrayList<>();
        try {
            if(jcsj != null && jcsj !=""){
                // Date dateHcsj= new SimpleDateFormat("yyyy-MM-dd").parse(hcsj);
                whshapeList= whshapeService.selectWhshapeDataListByJcsj(jcsj);
            }
            else {
                whshapeList = whshapeService.selectWhshapeDataList();
            }


        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
        return whshapeList;
    }

    @RequestMapping(value = "/selectWhshapeDate")
    //@GetMapping(value = "/{path}")
    public List<Date> selectWhshapeDate(){
        try {
            return whshapeService.selectWhshapeDate();
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }

    }

    /**
     * 林地
     * @param path
     * @return
     */
    @RequestMapping(value = "/insertldexcel")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<String> insertLdExcel(String path){
        try {
            if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }
            List<Ldshape> ldshapeList = excelReaderWhshape.readExcelDataLD(path);
            PathName pathName = pathRecordService.selectPath(path);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<String>("error:the file has been uploaded",HttpStatus.OK);
                }
            }
            boolean success = ldshapeService.insertLdshape(ldshapeList) > 0;
            pathRecordService.insertPathName(path);
            return new ResponseEntity<String>("success",HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @PostMapping(value = "/insertldexcelfile")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<JSON> insertLdExcelFile(@RequestParam("file") MultipartFile multipartFile){
        try {
            File file = null;
            String originalFilename = multipartFile.getOriginalFilename();
            String[] filename = originalFilename.split("\\.");
            file=File.createTempFile(filename[0], filename[1] + ".");
            multipartFile.transferTo(file);
          /*  if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }*/
            List<Ldshape> ldshapeList = excelReaderWhshape.readExcelDataLDWJ(file);
            PathName pathName = pathRecordService.selectPath(originalFilename);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"error:文件已上传file has been uploaded\"}"),HttpStatus.OK);
                }
            }
            boolean success = ldshapeService.insertLdshape(ldshapeList) > 0;
            pathRecordService.insertPathName(originalFilename);
            file.deleteOnExit();
            return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"成功success\"}"),HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @RequestMapping(value = "/selectLdshape")
    //@GetMapping(value = "/{path}")
    public List<Ldshape> selectLdshapeDataList(String jcsj){
        List<Ldshape> ldshapeList = new ArrayList<>();
        try {
            if(jcsj != null && jcsj !=""){
                // Date dateHcsj= new SimpleDateFormat("yyyy-MM-dd").parse(hcsj);
                ldshapeList= ldshapeService.selectLdshapeDataListByJcsj(jcsj);
            }
            else {
                ldshapeList = ldshapeService.selectLdshapeDataList();
            }
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
        return ldshapeList;
    }

    @RequestMapping(value = "/selectLdshapeDate")
    //@GetMapping(value = "/{path}")
    public List<Date> selectLdshapeDate(){
        try{
            return ldshapeService.selectLdshapeDate();
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }

    }


    /**
     * 矿山生产
     * @param path
     * @return
     */
    @RequestMapping(value = "/insertKsscexcel")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<String> insertKsscExcel(String path){
        try {
            if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }
            List<Ksscshape> ksscshapeList = excelReaderWhshape.readExcelDataKSSC(path);
            PathName pathName = pathRecordService.selectPath(path);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<String>("error:the file has been uploaded",HttpStatus.OK);
                }
            }
            boolean success = ksscshapeService.insertKsscshape(ksscshapeList) > 0;
            pathRecordService.insertPathName(path);
            return new ResponseEntity<String>("success",HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }


    @PostMapping(value = "/insertKsscexcelfile")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<JSON> insertKsscExcelFile(@RequestParam("file") MultipartFile multipartFile){
        try {
           /* if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }*/
            File file = null;
            String originalFilename = multipartFile.getOriginalFilename();
            String[] filename = originalFilename.split("\\.");
            file=File.createTempFile(filename[0], filename[1] + ".");
            multipartFile.transferTo(file);
            List<Ksscshape> ksscshapeList = excelReaderWhshape.readExcelDataKSSCWJ(file);
            PathName pathName = pathRecordService.selectPath(originalFilename);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"error:文件已上传file has been uploaded\"}"),HttpStatus.OK);
                }
            }
            boolean success = ksscshapeService.insertKsscshape(ksscshapeList) > 0;
            pathRecordService.insertPathName(originalFilename);
            file.deleteOnExit();
            return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"成功success\"}"),HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @RequestMapping(value = "/selectKsscshape")
    //@GetMapping(value = "/{path}")
    public List<Ksscshape> selectKsshapeDataList(String jcsj){
        List<Ksscshape> ksscshapeList = new ArrayList<>();
        try {
            if(jcsj != null && jcsj !=""){
                // Date dateHcsj= new SimpleDateFormat("yyyy-MM-dd").parse(hcsj);
                ksscshapeList= ksscshapeService.selectKsscshapeDataListByJcsj(jcsj);
            }
            else {
                ksscshapeList = ksscshapeService.selectKsscshapeDataList();
            }
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
        return ksscshapeList;
    }

    @RequestMapping(value = "/selectKsscshapeDate")
    //@GetMapping(value = "/{path}")
    public List<Date> selectKsscshapeDate(){
        try{
            return ksscshapeService.selectKsscshapeDate();
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
    }

    /**
     * 矿山生产
     * @param path
     * @return
     */
    @RequestMapping(value = "/insertKstcexcel")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<String> insertKstcExcel(String path){
        try {
            if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }
            List<Kstcshape> kstcshapeList = excelReaderWhshape.readExcelDataKSTC(path);
            PathName pathName = pathRecordService.selectPath(path);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<String>("error:the file has been uploaded",HttpStatus.OK);
                }
            }
            boolean success = kstcshapeService.insertKstcshape(kstcshapeList) > 0;
            pathRecordService.insertPathName(path);
            return new ResponseEntity<String>("success",HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @PostMapping(value = "/insertKstcexcelfile")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<JSON> insertKstcExcelFile(@RequestParam("file") MultipartFile multipartFile){
        try {
            /*if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }*/
            File file = null;
            String originalFilename = multipartFile.getOriginalFilename();
            String[] filename = originalFilename.split("\\.");
            file=File.createTempFile(filename[0], filename[1] + ".");
            multipartFile.transferTo(file);
            List<Kstcshape> kstcshapeList = excelReaderWhshape.readExcelDataKSTCWJ(file);
            PathName pathName = pathRecordService.selectPath(originalFilename);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"error:文件已上传file has been uploaded\"}"),HttpStatus.OK);
                }
            }
            boolean success = kstcshapeService.insertKstcshape(kstcshapeList) > 0;
            pathRecordService.insertPathName(originalFilename);
            file.deleteOnExit();
            return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"成功success\"}"),HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @RequestMapping(value = "/selectKstcshape")
    //@GetMapping(value = "/{path}")
    public List<Kstcshape> selectKstcshapeDataList(String jcsj){
        List<Kstcshape> kstcshapeList = new ArrayList<>();
        try {
            if(jcsj != null && jcsj !=""){
                // Date dateHcsj= new SimpleDateFormat("yyyy-MM-dd").parse(hcsj);
                kstcshapeList= kstcshapeService.selectKstcshapeDataListByJcsj(jcsj);
            }
            else {
                kstcshapeList = kstcshapeService.selectKstcshapeDataList();
            }
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
        return kstcshapeList;
    }

    @RequestMapping(value = "/selectKstcshapeDate")
    //@GetMapping(value = "/{path}")
    public List<Date> selectKstcshapeDate(){
        try{
            return kstcshapeService.selectKstcshapeDate();
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
    }

    @RequestMapping(value = "/insertKsyzlexcel")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<String> insertKsyzlExcel(String path){
        try {
            if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }
            List<Ksyzlshape> ksyzlshapeList = excelReaderWhshape.readExcelDataKSYZL(path);
            PathName pathName = pathRecordService.selectPath(path);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<String>("error:the file has been uploaded",HttpStatus.OK);
                }
            }
            boolean success = ksyzlshapeService.insertKsyzlshape(ksyzlshapeList) > 0;
            pathRecordService.insertPathName(path);
            return new ResponseEntity<String>("success",HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @PostMapping(value = "/insertKsyzlexcelfile")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<JSON> insertKsyzlExcel(@RequestParam("file") MultipartFile multipartFile){
        try {
            /*if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }*/
            File file = null;
            String originalFilename = multipartFile.getOriginalFilename();
            String[] filename = originalFilename.split("\\.");
            file=File.createTempFile(filename[0], filename[1] + ".");
            multipartFile.transferTo(file);
            List<Ksyzlshape> ksyzlshapeList = excelReaderWhshape.readExcelDataKSYZLWJ(file);
            PathName pathName = pathRecordService.selectPath(originalFilename);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"error:文件已上传file has been uploaded\"}"),HttpStatus.OK);
                }
            }
            boolean success = ksyzlshapeService.insertKsyzlshape(ksyzlshapeList) > 0;
            pathRecordService.insertPathName(originalFilename);
            file.deleteOnExit();
            return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"成功success\"}"),HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @RequestMapping(value = "/selectKsyzlshape")
    //@GetMapping(value = "/{path}")
    public List<Ksyzlshape> selectKsyzlshapeDataList(String jcsj){
        List<Ksyzlshape> ksyzlshapeList = new ArrayList<>();
        try {
            if(jcsj != null && jcsj !=""){
                // Date dateHcsj= new SimpleDateFormat("yyyy-MM-dd").parse(hcsj);
                ksyzlshapeList= ksyzlshapeService.selectKsyzlshapeDataListByJcsj(jcsj);
            }
            else {
                ksyzlshapeList = ksyzlshapeService.selectKsyzlshapeDataList();
            }
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
        return ksyzlshapeList;
    }

    @RequestMapping(value = "/selectKsyzlshapeDate")
    //@GetMapping(value = "/{path}")
    public List<Date> selectKsyzlshapeDate(){
        try{
            return ksyzlshapeService.selectKsyzlshapeDate();
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
    }

    @RequestMapping(value = "/insertZrbhdexcel")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<String> insertZrbhdExcel(String path){
        try {
            if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }
            List<Zrbhdshape> zrbhdshapeList = excelReaderWhshape.readExcelDataZRBHD(path);
            PathName pathName = pathRecordService.selectPath(path);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<String>("error:the file has been uploaded",HttpStatus.OK);
                }
            }
            boolean success = zrbhdshapeService.insertZrbhdshape(zrbhdshapeList) > 0;
            pathRecordService.insertPathName(path);
            return new ResponseEntity<String>("success",HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @PostMapping(value = "/insertZrbhdexcelfile")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<JSON> insertZrbhdExcelFile(@RequestParam("file") MultipartFile multipartFile){
        try {
            /*if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }*/
            File file = null;
            String originalFilename = multipartFile.getOriginalFilename();
            String[] filename = originalFilename.split("\\.");
            file=File.createTempFile(filename[0], filename[1] + ".");
            multipartFile.transferTo(file);
            List<Zrbhdshape> zrbhdshapeList = excelReaderWhshape.readExcelDataZRBHDWJ(file);
            PathName pathName = pathRecordService.selectPath(originalFilename);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"error:文件已上传file has been uploaded\"}"),HttpStatus.OK);
                }
            }
            boolean success = zrbhdshapeService.insertZrbhdshape(zrbhdshapeList) > 0;
            pathRecordService.insertPathName(originalFilename);
            file.deleteOnExit();
            return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"成功success\"}"),HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @RequestMapping(value = "/selectZrbhdshape")
    //@GetMapping(value = "/{path}")
    public List<Zrbhdshape> selectZrbhdshapeDataList(String jcsj){
        List<Zrbhdshape> zrbhdshapeList = new ArrayList<>();
        try {
            if(jcsj != null && jcsj !=""){
                // Date dateHcsj= new SimpleDateFormat("yyyy-MM-dd").parse(hcsj);
                zrbhdshapeList= zrbhdshapeService.selectZrbhdshapeDataListByJcsj(jcsj);
            }
            else {
                zrbhdshapeList = zrbhdshapeService.selectZrbhdshapeDataList();
            }
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
        return zrbhdshapeList;
    }

    @RequestMapping(value = "/selectZrbhdshapeDate")
    //@GetMapping(value = "/{path}")
    public List<Date> selectZrbhdshapeDate(){
        try{
            return zrbhdshapeService.selectZrbhdshapeDate();
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
    }

    @RequestMapping(value = "/insertWgjyexcel")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<String> insertWgjyExcel(String path){
        try {
            if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }
            List<Wgjyshape> wgjyshapeList = excelReaderWhshape.readExcelDataWGJY(path);
            PathName pathName = pathRecordService.selectPath(path);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<String>("error:the file has been uploaded",HttpStatus.OK);
                }
            }
            boolean success = wgjyshapeService.insertWgjyshape(wgjyshapeList) > 0;
            pathRecordService.insertPathName(path);
            return new ResponseEntity<String>("success",HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @PostMapping(value = "/insertWgjyexcelfile")
    //@GetMapping(value = "/{path}")
    @Transactional
    public ResponseEntity<JSON> insertWgjyExcelFile(@RequestParam("file") MultipartFile multipartFile){
        try {
            /*if (path == null || path == ""){
                return  new ResponseEntity<String>("error:the path is empty",HttpStatus.OK);
            }*/
            File file = null;
            String originalFilename = multipartFile.getOriginalFilename();
            String[] filename = originalFilename.split("\\.");
            file=File.createTempFile(filename[0], filename[1] + ".");
            multipartFile.transferTo(file);
            List<Wgjyshape> wgjyshapeList = excelReaderWhshape.readExcelDataWGJYWJ(file);
            PathName pathName = pathRecordService.selectPath(originalFilename);
            if (pathName != null){
                if(pathName.getPathname() != ""){
                    return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"error:文件已上传file has been uploaded\"}"),HttpStatus.OK);
                }
            }
            boolean success = wgjyshapeService.insertWgjyshape(wgjyshapeList) > 0;
            pathRecordService.insertPathName(originalFilename);
            file.deleteOnExit();
            return new ResponseEntity<JSON>(JSON.parseObject("{\"result\":\"成功success\"}"),HttpStatus.OK);

        }catch (Exception e){
            throw new RuntimeException("SQL operation failed", e);
        }
    }

    @RequestMapping(value = "/selectWgjyshape")
    //@GetMapping(value = "/{path}")
    public List<Wgjyshape> selectWgjyshapeDataList(String jcsj){
        List<Wgjyshape> wgjyshapeList = new ArrayList<>();
        try {
            if(jcsj != null && jcsj !=""){
                // Date dateHcsj= new SimpleDateFormat("yyyy-MM-dd").parse(hcsj);
                wgjyshapeList= wgjyshapeService.selectWgjyshapeDataListByJcsj(jcsj);
            }
            else {
                wgjyshapeList = wgjyshapeService.selectWgjyshapeDataList();
            }
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
        return wgjyshapeList;
    }

    @RequestMapping(value = "/selectWgjyshapeDate")
    //@GetMapping(value = "/{path}")
    public List<Date> selectWgjyshapeDate(){
        try{
            return wgjyshapeService.selectWgjyshapeDate();
        }catch (Exception e){
            throw new RuntimeException("SQL operation failed",e);
        }
    }
   /* @RequestMapping(value = "/insertadditionexcel")
    //@GetMapping(value = "/{path}")
    public ResponseEntity<Boolean> insertAdditionExcel(String path){

        try {
            List<Whshape> whshapeList = excelReaderWhshape.readExcelData(path);
            boolean success = whshapeAdditionService.insertAdditionWhshape(whshapeList) > 0;
            return ResponseEntity.ok(success);

        }catch (Exception e){
            e.printStackTrace();
            return ResponseEntity.ok(false);
        }

    }

    @RequestMapping(value = "/insertreductionexcel")
    //@GetMapping(value = "/{path}")
    public ResponseEntity<Boolean> insertReductionExcel(String path){

        try {
            List<Whshape> whshapeList = excelReaderWhshape.readExcelData(path);
            boolean success = whshapeReductionService.insertReductionWhshape(whshapeList) > 0;
            return ResponseEntity.ok(success);

        }catch (Exception e){
            e.printStackTrace();
            return ResponseEntity.ok(false);
        }

    }
*/



}


